#!user/bin/env python3
# -- coding: utf-8 --
import time

from selenium.webdriver.edge.service import Service
from selenium.webdriver.common.by import By
from selenium import webdriver

drive = webdriver.Edge(service=Service('./MicrosoftWebDriver.exe'))
drive.maximize_window()
drive.get('https://www.douban.com/')

iframe = drive.find_element(By.TAG_NAME, 'iframe')
drive.switch_to.frame(iframe)
pwd_in = drive.find_element(By.XPATH, "//*[text()='密码登录']")
pwd_in.click()

username = drive.find_element(By.CSS_SELECTOR, "#username")
username.clear()
username.send_keys('15170229563')

password = drive.find_element(By.CSS_SELECTOR, "#password")
password.clear()
password.send_keys('15170229563')

into = drive.find_element(By.CSS_SELECTOR, ".btn.btn-account ")
into.click()
time.sleep(5)
drive.close()
